home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr26 / netprog.zip / NETPROG.TAR / ipc / time_pipe.c < prev    next >
C/C++ Source or Header  |  1989-12-17  |  394b  |  27 lines

  1. #define    COUNT        20000
  2. #define    BUFFSIZE    128
  3.  
  4. char        buff[BUFFSIZE];
  5.  
  6. main()
  7. {
  8.     register int    i;
  9.     int        pipefd[2];
  10.  
  11.     if (pipe(pipefd) < 0)
  12.         err_sys("pipe error");
  13.  
  14.     for (i = 0; i < COUNT; i++) {
  15.         if (write(pipefd[1], buff, BUFFSIZE) < 0)
  16.             err_sys("write error");
  17.  
  18.         if (read(pipefd[0], buff, BUFFSIZE) != BUFFSIZE)
  19.             err_sys("read error");
  20.     }
  21.  
  22.     close(pipefd[0]);
  23.     close(pipefd[1]);
  24.  
  25.     exit(0);
  26. }
  27.